package com.jz.digital.bean;

import com.jz.digital.converter.PermissionBeanConverter;
import com.google.gson.annotations.Expose;

import org.greenrobot.greendao.annotation.Convert;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;

import java.util.List;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;

/**
 * ================================================
 * Created: WangYong
 * Date: 2024/11/24
 * Description:
 * ================================================
 */
@Entity(
        active = true
)
public class UserInfo {
    /**
     * 采购收料
     */
    public static final String PURCHASING_AND_RECEIVING_MATERIALS = "RXT20001";
    /**
     * 生产入库
     */
    public static final String FINISHED_PRODUCT_WAREHOUSING = "RXT20005";
    /**
     * 生产领料
     */
    public static final String PRODUCTION_MATERIAL_REQUISITION = "RXT20002";
    /**
     * 工序汇报
     */
    public static final String PROCESS_REPORT = "RXT20003";
    /**
     * 销售出库
     */
    public static final String FINISHED_PRODUCT_SHIPMENT = "RXT20009";
    @Id(autoincrement = true)
    @Expose(deserialize = false)
    private Long id;
    private String userId;
    private String userName;
    private String userKey;
    private String userDesc;
    private String startDate;
    private String endDate;
    private String userMobile;
    @Convert(converter = PermissionBeanConverter.class, columnType = String.class)
    private List<PermissionBean> permissionList;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 437952339)
    private transient UserInfoDao myDao;

    @Generated(hash = 480616041)
    public UserInfo(Long id, String userId, String userName, String userKey,
            String userDesc, String startDate, String endDate, String userMobile,
            List<PermissionBean> permissionList) {
        this.id = id;
        this.userId = userId;
        this.userName = userName;
        this.userKey = userKey;
        this.userDesc = userDesc;
        this.startDate = startDate;
        this.endDate = endDate;
        this.userMobile = userMobile;
        this.permissionList = permissionList;
    }

    @Generated(hash = 1279772520)
    public UserInfo() {
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserKey() {
        return userKey;
    }

    public void setUserKey(String userKey) {
        this.userKey = userKey;
    }

    public String getUserDesc() {
        return userDesc;
    }

    public void setUserDesc(String userDesc) {
        this.userDesc = userDesc;
    }

    public String getStartDate() {
        return startDate;
    }

    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }

    public String getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    public String getUserMobile() {
        return userMobile;
    }

    public void setUserMobile(String userMobile) {
        this.userMobile = userMobile;
    }

    public List<PermissionBean> getPermissionList() {
        return permissionList;
    }

    public void setPermissionList(List<PermissionBean> permissionList) {
        this.permissionList = permissionList;
    }

    public static class PermissionBean {
        private String userId;
        private String featuresId;
        private String featuresDesc;
        private int enFlag;

        public String getUserId() {
            return userId;
        }

        public void setUserId(String userId) {
            this.userId = userId;
        }

        public String getFeaturesId() {
            return featuresId;
        }

        public void setFeaturesId(String featuresId) {
            this.featuresId = featuresId;
        }

        public String getFeaturesDesc() {
            return featuresDesc;
        }

        public void setFeaturesDesc(String featuresDesc) {
            this.featuresDesc = featuresDesc;
        }

        public int getEnFlag() {
            return enFlag;
        }

        public void setEnFlag(int enFlag) {
            this.enFlag = enFlag;
        }

        @Override
        public String toString() {
            return "PermissionBean{" +
                    "userId='" + userId + '\'' +
                    ", featuresId='" + featuresId + '\'' +
                    ", featuresDesc='" + featuresDesc + '\'' +
                    ", enFlag=" + enFlag +
                    '}';
        }
    }

    @Override
    public String toString() {
        return "AdminBean{" +
                "userId='" + userId + '\'' +
                ", userName='" + userName + '\'' +
                ", userKey='" + userKey + '\'' +
                ", userDesc='" + userDesc + '\'' +
                ", startDate='" + startDate + '\'' +
                ", endDate='" + endDate + '\'' +
                ", userMobile='" + userMobile + '\'' +
                ", permissionList=" + permissionList +
                '}';
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 821180768)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getUserInfoDao() : null;
    }
}
